const { hexStripZeros } = require("ethers/lib/utils")

const main = async() => {
    const Counter = await hre.ethers.getContractFactory("Counter");
    const counter = await Counter.deploy();
    await counter.deployed();

    console.log(`Contract deployed at ${counter.address}`);

    let counts = await counter.getCounts();
    console.log(`Current counts (1): ${counts}`);

    await counter.add();
    counts = await counter.getCounts();
    console.log(`Current counts (2): ${counts}`);

    await counter.add();
    counts = await counter.getCounts();
    console.log(`Current counts (3): ${counts}`);
}

main()
    .then(() => {
        console.log(`Success!`);
        process.exit(0);
    })
    .catch((err) => {
        console.error(err);
        process.exit(1);
    })
    // [cyan@TianXuan helloweb3]$ npx hardhat run scripts/run.js
    // Contract deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3
    // Success!
    // npx hardhat run scripts/run.js --network localhost